#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

void test_string1()
{
	string s1;
	string s2("hello world");
	string s3(s2);

	cout << s1 << endl;
	cout << s2 << endl;
	cout << s3 << endl;
}

void test_string2()
{
	string s1("hello world");
	string s2 = "hello world";

	const string& s3 = "hello world";
}

void test_string3()
{
	string s1("hello world");
	/*cout << s1.size() << endl;
	cout << s1.length();*/

	for (size_t i = 0; i < s1.size(); i++)
	{
		cout << s1[i]++ << " ";
	}
	cout << endl;
	s1[0] = 'x';

	for (size_t i = 0; i < s1.size(); i++)
	{
		cout << s1[i] << " ";
	}
	cout << endl;

	string::iterator it = s1.begin();
	while (it != s1.end())
	{
		cout << *it << " ";
		it++;
	}
	cout << endl;

	for (auto e : s1)
	{                                             
		cout << e << " ";
	}
	cout << endl;

}

void test_string4()
{
	string s1("hello world");
	auto it1 = s1.begin();
	while (it1 != s1.end())
	{
		cout << *it1 << " ";
		it1++;
	}
	cout << endl;

	string::reverse_iterator it = s1.rbegin();
	while (it != s1.rend())
	{
		cout << *it << " ";
		it++;
	}
	cout << endl;

	sort(++s1.begin(), --s1.end());

	cout << s1 << endl;
}

void test_string5()
{
	string s1("hello world");
	cout << s1 << endl;

	s1.push_back('x');
	s1.append("fsfsf");

	s1 += 'u';
	s1 += "fsfsf";

	cout << s1 << endl;
}

int main()
{
	test_string5();
}